import request from '../utils/request';

export const fetchData = query => {
    return request({
        url: './table.json',
        method: 'get',
        params: query
    });
};

// 登录
export const login = (data)=>{
    return request({
        url:"/api/user/login.do",
        method:"post",
        params:{...data}
    })
}
// 注册
export const register = (data)=>{
    return request({
        url:"/api/user/register.do",
        method:"post",
        params:{...data}
    })
}
//商品
// 获取
export const good = (data)=>{
    return request({
        url:"/api/product/list.do",
        method:"post",
        params:{...data}
    })
}
// 查询
export const goodSearch = (data)=>{
    return request({
        url:"/api/product/search.do",
        method:"post",
        params:{...data}
    })
}
// 商品详情
export const goodDetail = (data)=>{
    return request({
        url:"/api/product/detail.do",
        method:"get",
        params:{...data}
    })
}
// 上架下架商品
export const setSaleStatus = (data)=>{
    return request({
        url:"/api/product/set_sale_status.do",
        method:"post",
        params:{...data}
    })
}
// 添加商品
export const saveGood = (data)=>{
    return request({
        url:"/api/product/save.do",
        method:"get",
        params:{...data}
    })
}
// 上传图片
export const uploadPic = (data)=>{
    return request({
        url:"/api/product/upload.do",
        method:"post",
        params:{...data}
    })
}

// 品类
// 获取列表
export const kind = (data)=>{
    return request({
        url:"/api/category/get_category.do",
        method:"post",
        params:{...data}
    })
}
// 添加
export const kindAdd = (data)=>{
    return request({
        url:"/api/category/add_category.do",
        method:"post",
        params:{...data}
    })
}
// 修改
export const kindUpdata = (data)=>{
    return request({
        url:"/api/category/set_category_name.do",
        method:"get",
        params:{...data}
    })
}





// 订单
// 获取
export const order = (data)=>{
    return request({
        url:"/api/order/list.do",
        method:"post",
        params:{...data}
    })
}
// 查询
export const orderSearch = (data)=>{
    return request({
        url:"/api/order/search.do",
        method:"post",
        params:{...data}
    })
}

// 详情
export const orderDetail = (data)=>{
    return request({
        url:"/api/order/detail.do",
        method:"post",
        params:{...data}
    })
}
// 用户
export const users = (data)=>{
    return request({
        url:"/api//user/list.do",
        method:"post",
        params:{...data}
    })
}